
#include "lib.h"

#include "TGame.h"

#include "tcpgame.h"
#include "ThreeCardRummyGame.h"

#include "stdlib.h"



///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn     TGame* TGame::createGame(ThreeCardConnection *pConn, TriCardGameId eGameId, 
///                                  int32 nAnteBet, int32 nSideBet)
///
/// Creates the appropriate game object instance for the speficied game type.
///
/// @param  pConn           (in)  The connection object that this game object will be using
/// @param  eGameId         (in)  Specifies which game the user is trying to play
/// @param  nAnteBet        (in)  The amount of the ante bet that the user made
/// @param  nSideBet        (in)  the amount of the bonus bet that the user made
///
/// @return TGame*      pointer to game object if successful, NULL on failure (e.g., invalid game id)
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////
TGame * TGame::createGame(ThreeCardConnection *pConn, TriCardGameId eGameId, int32 nAnteBet, int32 nSideBet)
{
    TGame *pRetVal = NULL;

    if(eGameId==TRICARD_POKER)
    {
        pRetVal = new ThreeCardPokerGame(pConn, nAnteBet, nSideBet);
    }
    else if(eGameId==TRICARD_RUMMY)
    {
		pRetVal = new ThreeCardRummyGame(pConn, nAnteBet, nSideBet);
    }

    return pRetVal;
}
